package org.ws.task.model;

import org.ws.task.common.IndexNumberUtils;

import java.io.Serializable;

/**
 * 一个任务项
 * @param <T>
 */
public class TaskItem<T> implements Serializable {

    public TaskItem(T data) {
        this.data = data;
        this.id = IndexNumberUtils.getTaskItemId();
        this.status = TaskStatus.READY;
        this.failedCount = 0;
    }

    // id：自动生成
    private long id;
    // 状态
    private TaskStatus status;
    // 失败次数
    private int failedCount = 0;
    // 数据
    private T data;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public TaskStatus getStatus() {
        return status;
    }

    public void setStatus(TaskStatus status) {
        this.status = status;
    }

    public int getFailedCount() {
        return failedCount;
    }

    public void setFailedCount(int failedCount) {
        this.failedCount = failedCount;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }
}
